package com.gold.util;

import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;

import javax.annotation.Resource;

/**
 * Created by Administrator on 2015-05-05 上午 10:45
 * 
 */public class InItSystem implements ApplicationListener<ContextRefreshedEvent> {

   /* @Resource
    private StaffService staffServices;*/

    @Override
    public void onApplicationEvent(ContextRefreshedEvent event) {
        /*if(event.getApplicationContext().getParent() == null){//root application context 没有parent，他就是老大.
            //需要执行的逻辑代码，当spring容器初始化完成后就会执行该方法。
            StaffInfo staffInfo = staffServices.load(1000000000);
            if(null==staffInfo){
                Stafflogin sl = new Stafflogin();
                sl.setPassword("123456");
                sl.setControlstatus(1);
                //Integer staffnumber, String departmentnumber, Integer storenumber, Integer type, String name, Integer gender, String phone, Stafflogin stafflogin
                staffInfo = new StaffInfo(1000000000,"100",100,1,"admin",1,"10086", sl);
                staffServices.save(staffInfo);
            }
        }*/
    }
}
